#!/usr/bin/env node

const http = require('http');

const options = {
  hostname: 'localhost',
  port: 3000,
  path: '/projects/cmenkhaca0000ltd55p0jylfd',
  method: 'GET'
};

const req = http.request(options, (res) => {
  console.log(`Status: ${res.statusCode}`);
  
  let data = '';
  
  res.on('data', (chunk) => {
    data += chunk;
  });
  
  res.on('end', () => {
    // Check if the page contains the project name
    if (data.includes('TAPD 电子产品研发管理系统')) {
      console.log('✅ 项目详情页面正常工作，项目名称已正确显示');
    } else if (data.includes('skeleton') || data.includes('animate-pulse')) {
      console.log('⏳ 页面正在加载中（显示骨架屏）');
    } else {
      console.log('❌ 项目详情页面可能存在问题，未找到项目名称');
    }
    
    // Check for error indicators
    if (data.includes('error') || data.includes('Error') || data.includes('404')) {
      console.log('❌ 页面中包含错误信息');
    }
    
    // Check for loading state
    if (data.includes('loading') || data.includes('Loading')) {
      console.log('⏳ 页面显示加载状态');
    }
  });
});

req.on('error', (e) => {
  console.error(`请求遇到问题: ${e.message}`);
});

req.end();